import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Layout from '@/layout/Index.vue'

const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        component: Layout,
        redirect: "/dashboard",
        children: [
            {
                path: "/dashboard",
                component: () => import("@/views/dashboard/Index.vue"),
                name: "dashboard",
                meta: {
                    title: "首页",
                    icon: "#icondashboard",
                }
            }
        ]
    },
    {
        path: "/system",
        component: Layout,
        name: "system",
        meta: {
            title: "系统管理",
            icon: "Setting",
            roles: ["sys:manage"],
        },
        children: [
            {
                path: "/employeeList",
                component: () => import("@/views/system/Employee/EmployeeList.vue"),
                name: "employeeList",
                meta: {
                    title: "用户管理",
                    icon: "UserFilled",
                    roles: ["sys:user"],
                },
            },
            {
                path: "/roleList",
                component: () => import("@/views/system/Role/RoleList.vue"),
                name: "RoleList",
                meta: {
                    title: "角色管理",
                    icon: "wallet",
                    roles: ["sys:role"],
                }
            },
            {
                path: "/menuList",
                component: () => import("@/views/system/Menu/MenuList.vue"),
                name: "MenuList",
                meta: {
                    title: "菜单管理",
                    icon: "Menu",
                    roles: ["sys:menu"],
                }
            },
        ]
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router